home *** CD-ROM | disk | FTP | other *** search
/ Hackers Matrix / Hacker's Matrix (nCite Software) (2003).iso / Tutorials / hTut_0131.txt < prev    next >
Text File  |  2002-12-13  |  18KB  |  396 lines

  1. ==================================================================
  2. == Protecting Files with Windows NTXP  ==   gE Technologies     ==
  3. ==  CACLS:  A new look at new methods  == www.nuketutorials.com ==
  4. ==================================================================
  5. = Last updated : 10th September 2002   by gloBal_enemy/Seremify  =
  6. = Email : seremify@yahoo.com.au             ICQ : 7929694        =
  7. ==================================================================
  8. Please do not mailbomb me or bombard me with **** as I do not
  9. appreciate it. If you have a question; ask me. I'll try to help
  10. but remember I'm doing this voluntarily and please give me some
  11. credit for even trying to help spread some useful tricks to those
  12. who don't know of them.
  13.  
  14. The same applies to viruses - I have antivirus running all the
  15. time 24/7 but it doesn't mean that it'll stop me from having to
  16. download **** on my 56kbps connection.
  17.  
  18. And I know I have mixed up the words "ATTRIBUTE" and "PARAMETER"
  19. a million times here but I hope you can still understand it.
  20.  
  21. DOS ownz j00.
  22.  
  23. ==================================================================
  24. LEGAL MUMBOJUMBO:
  25.  
  26. This document is provided 'as is' and is purely intended to be
  27. used as a reference document. It may not be redistributed without
  28. credit to the original owner -me under the alias "gloBal_enemy".
  29. If you wish to publish this article somewhere, please ask me first
  30. and I probably won't say NO, its just more of an interests sake.
  31. I'm sure Da Vinci would've liked to know that his paintings and
  32. work would be some of the most respected/valued works in the
  33. world.
  34.  
  35. You may not modify this document in any way and then reproduce it
  36. and claim it as your own. You may quote it or use the whole article
  37. but PLEASE provide credit and if possible email me (as I enjoy
  38. reading emails from people who read my guides on various topics).
  39. Make sure to use an accurate subject and speak in English (my
  40. skills in Japanese, Malay and Chinese are very limited but I will
  41. try my best).
  42.  
  43. If you want to publish this file on your site because you think it
  44. is "THAT GOOD" please do; but do not change anything and of course
  45. email me. I might even (one day) add a link to all the places that
  46. host this file (assuming it ever spreads) onto my own site (which I
  47. am yet to have besides NukeTuts).
  48.  
  49. I take NO RESPONSIBILITY for your actions.
  50.  
  51. If you cannot figure out how it works, you can email me and I'll
  52. most likely respond (unless I'm away of course) but if you
  53. suffer physical or mental problems, or encounter financial
  54. difficulties, then it is not my fault. Fair enough? If not, then
  55. stop reading.
  56.  
  57. This document does not provide any insight into 'hacking' computer
  58. systems but rather how to protect them and what to do if someone
  59. has used the technique against you.
  60. ==================================================================
  61.  
  62. I will admit I didn't come across this CACLS thing on my own, I
  63. had the help of a friend who uses the alias "KKOÖ" so I thank him
  64. for telling me about this.
  65.  
  66. ==================================================================
  67.  
  68. Anyway I noticed on ASTALAVISTA there are many ways to protect
  69. stuff in Windows 2000 when your on a shared area and so on; but
  70. what if you don't have your own account and you access the generic
  71. account (in our case it was "Student" and "Computing"). The tricks
  72. of using special characters do not apply if you can still open the
  73. folders through Windows Explorer, and the DOS commands for renaming
  74. them using a password is too much trouble (not to mention if
  75. someone has an ASCII chart they'll find it in not too much time).
  76.  
  77. This method of locking files/folders could be used in conjunction
  78. with the ASCII locking but I'm too lazy to use that method.
  79.  
  80. This method is FAR from secure. The only reason why it is; is
  81. because there are alot of people who don't even know of it (such as
  82. myself) until recently. If you feel that you are in an environment
  83. of people who do not know very very advanced (undocumented) things
  84. in DOS/Win2k/XP then carry on.
  85.  
  86. This system is mainly for people who do not have much power or
  87. priveliges (in our case it was the STUDENT account for the school)
  88. and this allows you to protect your work from being deleted by
  89. other more ignorant students.
  90.  
  91. ==================================================================
  92. ** If you believe this could help you; carry on **
  93. ==================================================================
  94.  
  95. This method "CACLS" uses Windows inbuilt security systems also
  96. known as ACLs (Access Control Lists) which determine who can and
  97. can't access files. All admins have the power to control this via
  98. Windows Explorer but lower level users are likely to not have
  99. access to Windows Explorer or Right Mouse buttons, let alone
  100. access to the Permissions tab on File Properties.
  101.  
  102. The concept is simple; since you are OWNER you have full permission
  103. rights over files. OWNER and ADMINISTRATOR have same level of power
  104. for each file; but usually the Administrator is the owner if it is
  105. a system file (such as Windows) but if you make a Word Document or
  106. a Powerpoint presentation; then this method would prevent other
  107. foolish/stupid users from deleting it. 
  108.  
  109. To do so, you (as owner) have to block all access to this file
  110. (including yourself). This will work because it blocks USERNAMES
  111. and not computers or domains. There are ways to block them but it
  112. is pointless in my situation so I have yet to explore; feel free
  113. to comment on it (and if suitable I can add it to this file).
  114.  
  115. The method of CACLS also shows an "ACCESS DENIED" error (how nice)
  116. should one try to modify (that includes EDIT and RENAME), move,
  117. delete, or open/run the file. In DOS it will result in an ACCESS
  118. DENIED message but ALSO it will allow users into directories but
  119. when they try to see whats inside it will be blank. A solution
  120. around this is to use the /T switch (explained in ADVANCED section
  121. of this file).
  122.  
  123. ==================================================================
  124. CACLS filename [/T] [/E] [/C] [/G user:perm] [/R user [...]]
  125. [/P user:perm [...]] [/D user [...]]
  126. ==================================================================
  127.  For more info try typing CACLS into Win2k/XP Dos/Command prompt
  128.  for more instructions; or just keep reading for more easy2read
  129.  instructions. Beware there may be alot of me sidetracking...
  130. ==================================================================
  131.  
  132.  
  133. >From the above you can see there are multiple ways to do certain
  134. things and many additional options you can use. The key commands
  135. that you need to know (assuming you have DOS access) are;
  136.  
  137. (The example file will always be "happy.ppt" and the directory is
  138. called "h:\gEtech"; the username is "Computing" and computername
  139. is "C5-01")
  140.  
  141. CACLS h:\gEtech\
  142.  - This will result in DOS showing you what the current ACL of a
  143.  directory is.
  144.  
  145.  H:\gEtech\ c5-01\Student:(OI)(CI)F
  146.  
  147.  The first part is self-explanatory (that is the file in question)
  148.  but the latter can be different depending on situation. It says
  149.  "c5-01" but if you were on a domain it would be the domain name
  150.  and the second section is the username from either the local PC
  151.  or domain. In this example ADMINISTRATOR does not have access to
  152.  the file and they never will; unless they are smart enough to
  153.  either change the owner (not too difficult) or to login as you
  154.  and then change the ACL. Both are possible for a 'determined'
  155.  admin.
  156.  As another sidenote; the (OI)(CI) mean that all files and
  157.  subdirectories within will be covered by the ACE. The colon
  158.  (:) seperates the username from the permissions. More on ACE
  159.  later...
  160.  
  161. CACLS h:\gEtech\happy.ppt
  162.  - This will result in DOS showing you what the current ACL of
  163.  the file(s) is.
  164.  
  165. CACLS h:\gEtech\ /d Everyone
  166.  - This command is saying DENY access to the folder to EVERYONE;
  167.  that is ALL USERS including yourself. It will prompt for a 'Y'
  168.  to confirm it.
  169.  
  170.  The (d - DENY) attribute means exactly that. It does not allow
  171.  any user (when used with EVERYONE) to open the file, rename it,
  172.  delete it, modify it, or anything. The only user with enough
  173.  power to change it (besides Administrator) is the person who
  174.  created it. The person who created it (you I hope) can then
  175.  apply a permission to it and stop access.
  176.  
  177. CACLS h:\gEtech\happy.ppt /d Everyone
  178.  - Same as above except to the individual file only.
  179.  
  180. CACLS h:\gEtech\ /e /d MrSmith
  181.  - This uses the /e which adds/modifies the current ACL rather
  182.  than totally clear it out and replace it. This works well when
  183.  you want to give different users different permissions.
  184.  
  185. CACLS h:\gEtech\ /g Lark:R
  186.  - This uses the (g - GRANT) and the (R - Read Only) attributes.
  187.  
  188.  By using this command you would be granting the user LARK to
  189.  READ ONLY. This means they cannot delete nor modify the file but
  190.  they have access to opening it and saving it elsewhere.
  191.  
  192. CACLS h:\gEtech\ /e /g Minat:F
  193.  - This uses (e - Edit) and (g - Grant) and (f - Full Access)
  194.  attributes. It will give the user MANIT full access to the folder
  195.  whilst retaining the previous settings for other users.
  196.  
  197. There are other ways of granting and denying as you can probably
  198. already tell but those are the most simplified methods. And yes it
  199. is possible to do more than one at a time but I prefer to keep it
  200. simple and to ensure I don't make mistakes. With the problem of
  201. having to try to convert 255character names into 8, making a mistake
  202. on CACLS is something you don't want to have to go back to. You can
  203. use wildcards to combine files and users but again I don't like
  204. making mistakes but if you must, you use *.exe to make all EXEcutable
  205. files selected, and Happy.* to make all files with the name Happy
  206. but an unknown extension selected. The rest you can figure out..
  207.  
  208. Don't go locking the whole computer or you might get into trouble.
  209. There are plenty of ethic guides to hacking on the net. Read them
  210. if you think you may be a script kiddie or n00b of some sort.
  211.  
  212. If you must know more, continue reading; otherwise skip down a bit
  213. and read more useful and somewhat relevant stuff.
  214.  
  215. ==================================================================
  216. More advanced but somewhat useless commands..
  217.  
  218. CACLS h:\gEtech\ /t /g Student:F
  219.  By using /T you are making it apply to all subdirectories.
  220.  
  221. CACLS h:\gEtech\*.exe /c /g Student:F
  222.  If there were files in that folder (gETech) that were not owned
  223.  by yourself; then they will not be granted access to. The /C will
  224.  make it continue processing files even if there is an error.
  225.  
  226. CACLS h:\gEtech\happy.ppt /e /r Computing
  227.  This uses /R to revoke any rights the user 'Computing' has. It
  228.  will only work with /E since it modifies the current ACL so all
  229.  other details/rights are left intact.
  230.  
  231. CACLS h:\gEtech\happy.ppt /p Computing:F
  232. CACLS h:\gEtech\happy.ppt /p Computing:R
  233. CACLS h:\gEtech\happy.ppt /p Computing:W
  234.  Above are some examples of /p (REPLACE USER RIGHTS) and I have
  235.  included a small ASCII (*gasp*) table of the different combos.
  236.  
  237. Rights - what goes after the colon :
  238. Name - what its called
  239. O - Can it be Opened (the file/folder ACL applies to)
  240.     Once opened it can be saved anywhere else.
  241. R - Can it be renamed?
  242.     Even if file is READ ONLy you can still copy it elsewhere.
  243. M - Can it be moved? (essentially the same as above)
  244. W - Can it be written to? (ie. Adding text to a word document)
  245. D - Can it be deleted?
  246.     Even if it can't be deleted, if they can write to it, one
  247.     user could clear out the whole file (making it empty) and
  248.     save it.
  249. A - Can the ACLs be viewed?
  250.  
  251.    =============================================================
  252.    = Rights = Name    = O = R = M = W = D = A = Used with      =
  253.    =============================================================
  254.    = N      = None    = N = N = N = N = N = N = /P             =
  255.    = R      = Read    = Y = N = N = N = N = Y = /G /P          =
  256.    = W      = Write   = Y = N = N = Y = N = Y = /G /P          =
  257.    = C      = Change  = Y = Y = Y = Y = N = Y = /G /P          =
  258.    = F      = FULL    = Y = Y = Y = Y = Y = Y = /G /P          =
  259.    =============================================================
  260.  
  261. CACLS h:\gETech\happy.ppt /e /r Computing
  262.  This will revoke the user Computing's rights. Also note (I just
  263.  remembered) that there is no mention of domain. You can specify
  264.  one if you wish but if you don't, then it applies to any user
  265.  trying to access the file/folder(s) from that account whether
  266.  they are local or roaming.
  267.  Revoke just removes any right (makes them a "N") the user has but
  268.  it must be used with /e as it does NOT change the ACL settings.
  269.  
  270. ==================================================================
  271. Want to make a batch file? Or go even further with VB?
  272.  
  273. If you want automation make note of the following;
  274.  
  275. If you wish to use something which does not contain "/E" there
  276. will be a prompt. The prompts can be pressed automatically by
  277. using the following line;
  278.  
  279. echo y|cacls h:\gETech /g Computing:F
  280.  
  281. Note there is no space between 'y' and | and 'cacls'. This will
  282. automatically pipe the pressing of a Y into the cacls program.
  283.  
  284. If you wish to make it automatic but not use a Y, try using the
  285. /E (edit) parameter. This does not have a prompt so it works
  286. well with VB.
  287.  
  288. This brings me to my next point. I am yet to impliment CACLS
  289. properly into Visual Basic - please email me if you do find a way
  290. to automatically supress the "Y" without the use of a batch file.
  291.  
  292. If you want to call it; the file is located (CACLS) in;
  293. C:\WINNT\System32\CACLS.exe
  294.  
  295. ..so by use of a Shell(c:\winnt\system32\cacls.exe /g computing:f)
  296. you should get somewhere. Any further than that I cannot do as
  297. I cannot supress the button automatically.
  298.  
  299. ==================================================================
  300. If your an administrator trying to fix the problem of someone
  301. making your network full of CACLS's stuff then read on;
  302.  
  303. First you need to make yourself OWNER of the files. There are two
  304. ways to do this.
  305.  
  306. One is by opening up Windows Explorer (Winkey + E), finding the
  307. locked folder/files, right clicking them and then in the tab
  308. "PERMISSIONS" or "ACCESS" make yourself OWNER of the file. There
  309. are various ways of doing this, or just give yourself FULL ACCESS.
  310. If it does not let you gain full access, you will have to make
  311. yourself OWNER and that requires a bit of menu navigating but I'm
  312. sure you will find it. In Windows XP it will prompt you that you
  313. must be OWNER and ask if you wish to make yourself OWNER if you
  314. attempt to change anything.
  315.  
  316. "The GUI in File Manager or Windows NT Explorer is currently
  317. limited to replacing the ACLs."
  318. -Taken from the Microsoft Article on CACLS listed below
  319.  
  320. The second method requires you to login as that user. Whether that
  321. means you have to give him a blank password and then login as them
  322. or you just get them to do it; this is the more obvious way to do it
  323. and is a good way of punishing someone. To unlock the files from
  324. here, you just use the above "GRANT" commands to allow access.
  325.  
  326. Note: You cannot remove an ACL as there is always one.
  327.  
  328. ==================================================================
  329. ACE - Access Control Entries
  330.  .. or known as "Container Access Inheritence Flags"
  331.  
  332. This is one of the smarter names used. If the container is locked,
  333. you cannot open it. If the container is see through (Folder is
  334. allowed to be opened but files inside are not - NP) you can still
  335. see whats inside but you can't touch.
  336.  
  337. ACE's come about because certain files (such as files inside your
  338. profile) only obtain their ACL or Access Rights because they are
  339. located within another folder (or container in this analogy).
  340.  
  341. IO
  342.  - means "Inherit Only" - it will not affect the current item but
  343.    it will travel within if other tags are used. This is a good
  344.    example of a clear container.
  345.  
  346. CI
  347.  - means "Container Inherit" - if there are smaller containers
  348.    inside then they will have the same attributes as being set. If
  349.    used with the IO then of course the insides will be invisible
  350.    but the outside container will be see through.
  351.  
  352. OI
  353.  - means "Object Inherit" - if there are any files within this
  354.    container they will share the same attributes as the file being
  355.    selected. If you use the IO then of course they will be invisible.
  356.  
  357. NP
  358.  - means "Non-Propogate" - this means that whatever you set here will
  359.    not affect the insides in any way. If someone knows the exact path
  360.    to a file and you use this tag, then they can get access to the file
  361.    or unlocked folders as they need.
  362.  
  363. For more information see the Microsoft article below;
  364. ==================================================================
  365. LINKS
  366.  
  367. Microsoft's Guide to ACL/CACLS
  368. http://support.microsoft.com/default.aspx?scid=kb;en-us;Q162786
  369.  
  370. Microsoft's Article on ACE
  371. http://support.microsoft.com/default.aspx?scid=KB;EN-US;Q220167&
  372.  
  373. Astalavista
  374. http://www.astalavista.com
  375.  
  376. GameFAQs
  377. http://www.gamefaqs.com
  378.  
  379. NukeTutorials
  380. http://www.nuketutorials.com
  381.  
  382. KazaaLite.com
  383. http://www.kazaalite.com
  384. ==================================================================
  385. The end
  386. I hope this proves helpful.
  387. Please email me if it does; any comments, suggestions, all are
  388. appreciated. Any ideas what to do next? I'm doing PHPNuke stuff
  389. at the moment as well so feel free to talk about that.
  390.  
  391. seremify@yahoo.com.au
  392. Don't forget to write.
  393. ==================================================================
  394. Copyright 2002 Jeff C aka gloBal_enemy
  395. Do not steal.
  396. Plagurism is bad.